package ynu.czs.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import ynu.czs.pojo.Orders;
import ynu.czs.pojo.Result;


/**
 * 订单服务 Feign 客户端
 */
@FeignClient(name = "orders-service", contextId = "orderClient2")
public interface OrdersFeignClient {

    /**
     * 创建新订单
     */
    @PostMapping("/orders")
    Result addOrders(@RequestBody Orders orders);

    /**
     * 获取订单详情列表
     */
    @GetMapping("/orders/orderDetailet/{orderId}")
    Result getOrderDetailets(@PathVariable("orderId") Integer orderId);

    /**
     * 获取订单关联的商家信息
     */
    @GetMapping("/orders/businessInfo/{orderId}")
    Result getBusinessByOrderId(@PathVariable("orderId") Integer orderId);

    /**
     * 根据订单ID获取订单信息
     */
    @GetMapping("/orders/{orderId}")
    Result getOrderByOrderId(@PathVariable("orderId") Integer orderId);

    /**
     * 更新订单信息
     */
    @PutMapping("/orders")
    Result updateOrders(@RequestBody Orders orders);

    /**
     * 删除订单
     */
    @DeleteMapping("/orders/{orderId}")
    Result deleteOrders(@PathVariable("orderId") Integer orderId);
}
